import Vue from 'vue'
import App from './App'
import axios from 'axios'
import router  from './router'
import {store} from './store/store.js'
import {zcServer} from './common/js/zcServer'
import zcAliFile from './common/js/zcAliFile'
import zcWin from './common/js/zcWin'
import VueRecyclerviewNew from 'vue-recyclerview'

Vue.use(VueRecyclerviewNew);
// let ZcSoft_WxOpenId_VueBind_Info2 = {};
//   ZcSoft_WxOpenId_VueBind_Info2.OrganCode = "01";
//   ZcSoft_WxOpenId_VueBind_Info2.DeviceCode = "008";
//   ZcSoft_WxOpenId_VueBind_Info2.OpenId = "oDBXTs3Zgh-zXcDRK-IWmfrluLGg";
//   ZcSoft_WxOpenId_VueBind_Info2.Telephone = '1366666666';
//   localStorage.setItem('ZcSoft_WxOpenId_VueBind_Info',JSON.stringify(ZcSoft_WxOpenId_VueBind_Info2))
//   localStorage.setItem('userId',ZcSoft_WxOpenId_VueBind_Info2.OpenId)

let ZcSoft_WxOpenId_VueBind_Info = localStorage.getItem('ZcSoft_WxOpenId_VueBind_Info');
if(ZcSoft_WxOpenId_VueBind_Info) {
  ZcSoft_WxOpenId_VueBind_Info = JSON.parse(ZcSoft_WxOpenId_VueBind_Info);
}
Vue.prototype.$bus = new Vue();
Vue.prototype.$Global = {
  http:axios,
  zcServer:zcServer,
  zcAliFile:zcAliFile,
  zcDomain:zcServer.zcDomain,
  zcWin:zcWin,
  PersonSN:'',
  GB_OrganSN:'',
  UserId:ZcSoft_WxOpenId_VueBind_Info.OpenId,
  OrganCode:ZcSoft_WxOpenId_VueBind_Info.OrganCode,
  DeviceCode:ZcSoft_WxOpenId_VueBind_Info.DeviceCode,
  routerBack:''
}

Vue.config.productionTip = false;

new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>',
  created(){
  }
});

router.beforeEach((to, from, next) => {
  /* 路由发生变化修改页面title */
  if (to.meta.title) {
    document.title = to.meta.title
    next()
  }
  else{
    next();
  }
})
//   if(Vue.prototype.$Global.UserId=='1'){
//
// next({
//   path:"/Regist",
//   query:{redirect:to.fullPath}
// })
//   }else {
//     next()
//   }

